SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[DnnProduct_CDS_DistributorUserGetDistributors]
AS
BEGIN
	SET NOCOUNT ON;

	DECLARE @DistID_PID int
	SELECT @DistID_PID = PropertyDefinitionID FROM [DnnProduct_ProfilePropertyDefinition] WHERE PropertyName = 'DistID'
	
	SELECT distID, name FROM DISC_DistributorConfig
	WHERE distID IN (SELECT	UP1.PropertyValue FROM [DnnProduct_UserProfile] UP1 WHERE UP1.PropertyDefinitionID = @DistID_PID AND LEN(UP1.PropertyValue) > 0)
END
GO
